package com.wulin.learning.设计模式.外观模式;

/**
 * @author liuwulin
 * @date 2023/10/18-11:25
 * @DESC 外观类，统一入口
 */
public class EncryptFacade extends AbstractEncryptFacade{
    //维持对其他对象的引用
    private FileReader reader;
    private CipherMachine cipher;
    private FileWriter writer;

    public EncryptFacade() {
        reader = new FileReader();
        cipher = new CipherMachine();
        writer = new FileWriter();
    }

    //调用其他对象的业务方法
    public void FileEncrypt(String fileNameSrc, String fileNameDes) {
        String plainStr = reader.Read(fileNameSrc);
        String encryptStr = cipher.Encrypt(plainStr);
        writer.Write(encryptStr, fileNameDes);
    }
}
